package com.pjmike.common.service.Impl;

import com.pjmike.common.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class TestServiceImpl implements TestService {

    private static final Logger log= LoggerFactory.getLogger(TestServiceImpl.class);

    @Override
    public long countFansCountByUserId(Long uid) {
        log.info("获取countFansCountByUserId的线程"+Thread.currentThread().getName());
        try{
            Thread.sleep(10000);
            log.info("FansCount===睡眠:"+10+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public long countMsgCountByUserId(Long uid) {
        log.info("获取countMsgCountByUserId的线程"+Thread.currentThread().getName());
        try{
            Thread.sleep(10000);
            log.info("获取MsgCount===睡眠:"+10+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public long countCollectCountByUserId(Long uid) {
        log.info("获取countCollectCountByUserId的线程"+Thread.currentThread().getName());
        try{
            Thread.sleep(10000);
            log.info("获取CollectCount===睡眠:"+10+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public long countFollowCountByUserId(Long uid) {
        log.info("获取countFollowCountByUserId的线程"+Thread.currentThread().getName());
        try{
            Thread.sleep(10000);
            log.info("获取FollowCount===睡眠:"+10+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public long countRedBagCountByUserId(Long uid) {
        log.info("获取countRedBagCountByUserId的线程"+Thread.currentThread().getName());
        try{
            TimeUnit.SECONDS.sleep(4);
            log.info("获取RedBagCount===睡眠:"+4+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public long countCouponCountByUserId(Long uid) {
        log.info("获取countCouponCountByUserId的线程"+Thread.currentThread().getName());
        try{
            TimeUnit.SECONDS.sleep(8);
            log.info("获取CouponCount===睡眠:"+8+"s");
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
